/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

package gameserver.configs;

import java.util.regex.Pattern;

import commons.configuration.Property;

public class GameServerConfig
{
	/**
	* Server name
	*/
	@Property(key = "gameserver.name", defaultValue = "aion private")
	public static String	SERVER_NAME;

	/**
	* Character name pattern (checked when character is being created)
	*/
	@Property(key = "gameserver.character.name.pattern", defaultValue = "[a-zA-Z]{2,16}")
	public static Pattern	CHAR_NAME_PATTERN;

	/**
	* Pet name pattern (checked when pet is being created or renamed)
	*/
	@Property(key = "gameserver.pet.name.pattern", defaultValue = "[a-zA-Z]{2,16}")
	public static Pattern	PET_NAME_PATTERN;

	/**
	* Server Country Code
	*/
	@Property(key = "gameserver.country.code", defaultValue = "1")
	public static int	SERVER_COUNTRY_CODE;
	
	/**
	* ManaStone Rates
	*/
	@Property(key = "gameserver.manastone.percent.slot1", defaultValue = "98")
	public static int	MS_SLOT1;
	@Property(key = "gameserver.manastone.percent.slot2", defaultValue = "85")
	public static int	MS_SLOT2;
	@Property(key = "gameserver.manastone.percent.slot3", defaultValue = "75")
	public static int	MS_SLOT3;
	@Property(key = "gameserver.manastone.percent.slot4", defaultValue = "65")
	public static int	MS_SLOT4;
	@Property(key = "gameserver.manastone.percent.slot5", defaultValue = "55")
	public static int	MS_SLOT5;
	@Property(key = "gameserver.manastone.percent.slot6", defaultValue = "45")
	public static int	MS_SLOT6;
	@Property(key = "gameserver.manastone.percent.slot7", defaultValue = "35")
	public static int	MS_SLOT7;
	
	/**
	* Supplement Additional Success Rates
	*/
	@Property(key = "gameserver.supplement.lesser", defaultValue = "10")
	public static int	LSSUP;
	@Property(key = "gameserver.supplement.regular", defaultValue = "15")
	public static int	RGSUP;
	@Property(key = "gameserver.supplement.greater", defaultValue = "20")
	public static int	GRSUP;
	
	/**
	* Interval for deadlock detector run schedule
	*/
	@Property(key = "gameserver.deadlock.interval", defaultValue = "300")
	public static int	DEADLOCK_DETECTOR_INTERVAL;

	/**
	* Enable/disable deadlock detector
	*/
	@Property(key = "gameserver.deadlock.enable", defaultValue = "true")
	public static boolean	DEADLOCK_DETECTOR_ENABLED;
	
	@Property(key = "thread.basepoolsize", defaultValue = "2")
	public static int	BASE_THREAD_POOL_SIZE;
	
	@Property(key = "thread.threadpercore", defaultValue = "4")
	public static int	EXTRA_THREAD_PER_CORE;
	
	@Property(key = "thread.runtime", defaultValue = "5000")
	public static long	MAXIMUM_RUNTIME_IN_MILLISEC_WITHOUT_WARNING;
	
	public static int	THREAD_POOL_SIZE;
	
	public static void load()
	{
		final int baseThreadPoolSize = BASE_THREAD_POOL_SIZE;
		final int extraThreadPerCore = EXTRA_THREAD_PER_CORE;

		THREAD_POOL_SIZE = baseThreadPoolSize + Runtime.getRuntime().availableProcessors() * extraThreadPerCore;
	}
	
	@Property(key = "gameserver.shutdown.mode", defaultValue = "1")
	public static int	HOOK_MODE;

	@Property(key = "gameserver.shutdown.delay", defaultValue = "60")
	public static int	HOOK_DELAY;

	@Property(key = "gameserver.shutdown.interval", defaultValue = "1")
	public static int	ANNOUNCE_INTERVAL;

	@Property(key = "gameserver.shutdown.safereboot", defaultValue = "true")
	public static boolean	SAFE_REBOOT;
}
